package httpServer

import (
	"sync"

	"public.com/Framework/webServer"
)

var (
	httpServerObj = webServer.NewHttpServer(":123", false)
)

func init() {
	// 设置跨域
	header := make(map[string]string)
	header["Access-Control-Allow-Origin"] = "*"
	header["Access-Control-Allow-Methods"] = "POST, GET"
	header["Access-Control-Allow-Headers"] = "Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization"
	httpServerObj.SetHeader(header)
}

// 启动HttpServer
func Start(wg *sync.WaitGroup) {
	httpServerObj.Start(wg)
}

// 获取HttpServer对象
func GetHttpServer() *webServer.HttpServer {
	return httpServerObj
}
